<?php
namespace app\api\controller;
use think\Db;


class Diylayout extends Common{

    public function getDiylayout(){
        $tokenRes = $this->checkToken(0);
        if($tokenRes['status'] == 400){
            datamsg(400,$tokenRes['mess']);
        }
        $projectId = input('post.project_id');
        if (!$projectId) {
            datamsg(400,'项目id不能为空');
        }
        $front_layout = Db::name("front_layout")->where("project_id",$projectId)->find();
        $front_layout['diy_data'] = html_entity_decode($front_layout['diy_data']);
        if(!$front_layout){
            $front_layout['diy_data'] = '{"pages":[{"id":"000000","name":"首页","home":true,"componentList":[{"component":"NavBar","name":"自定义导航","icon":"icon-sousuo","value":{"leftIcon":"map","leftLabel":"","searchText":"请输入关键词","searchLink":"pagesC/search/searchAll","iconColor":"rgba(255, 205, 0, 1)","rightIcon":"chat","iconRightColor":"rgba(255, 255, 255, 1)","iconLeftColor":"rgba(255, 255, 255, 1)"},"styles":{"shape":"square","location":"left","cmpBackground":"#FFFFFF","background":"rgba(238, 59, 59, 1)"},"id":"16847630235Ln7AP","height":44},{"component":"WoTabs","name":"分类tab栏","icon":"icon-swiper","list":[{"id":"0001","name":"全部","jump":""},{"id":"1685242052EjA0QV","name":"玩具乐器","jump":"pagesC/goods/categoryGoods?id=33"},{"id":"1685242054Nu2Sd4","name":"家用电器","jump":"pagesC/goods/categoryGoods?id=32"},{"id":"1685242056Rmy3NR","name":"家具家装","jump":"pagesC/goods/categoryGoods?id=35"},{"id":"1685259728JkUgke","name":"家具厨具","jump":"http://localhost:8081/h5/#/pagesC/goods/categoryGoods?id=34"},{"id":"16852597428geUUG","name":"手机数码","jump":"pagesC/goods/categoryGoods?id=31"},{"id":"1685259746ewXheb","name":"男鞋","jump":"/pagesC/goods/categoryGoods?id=40"},{"id":"1685259752AESqCt","name":"女鞋","jump":"pagesC/goods/categoryGoods?id=2"},{"id":"16852597606rWcy7","name":"美妆护肤","jump":"pagesC/goods/categoryGoods?id=37"},{"id":"1685259789Yd2oXS","name":"男装","jump":"pagesC/goods/categoryGoods?id=38"},{"id":"1685259796RGRX5M","name":"女装","jump":"pagesC/goods/categoryGoods?id=2"},{"id":"1685259800oBe7hT","name":"母婴","jump":"pagesC/goods/categoryGoods?id=315"}],"attrs":{"model":"basis","autoplay":true,"loop":true,"currentIndex":0},"styles":{"pagePadding":0,"negativeMarginBottom":0,"tabHeight":81,"currentIndex":0,"fontSize":32,"tabGutter":21,"inactiveColor":"rgba(51, 51, 51, 1)","bgColor":"rgba(255, 255, 255, 1)","activeColor":"rgba(255, 76, 21, 1)"},"id":"1685060024s9g66Z","height":40},{"component":"McSwiper","name":"广告轮播","icon":"icon-swiper","list":[{"id":"0001","image":"https://uploadfile.wo-shop.net/uploads/file/20230720/876b7e6f9714498d86f6f5f03fa3ef2c.jpg"},{"id":"0002","image":"https://uploadfile.wo-shop.net/uploads/file/20230720/8a0d0dd8ed4d4cfc2dc3734c6ab393e1.jpeg"}],"attrs":{"model":"basis","autoplay":true,"loop":true},"styles":{"pagePadding":13,"negativeMarginBottom":16,"negativeMarginTop":9},"id":"1684766342k3bvG8","height":150},{"component":"McTab","name":"金刚位导航","icon":"el-icon-discover","tabList":[{"id":"0001","label":"超级秒杀","image":"https://uploadfile.wo-shop.net/uploads/file/20230720/efb30f433b569b7c0b4630ef304b4a03.png","jump":{"type":"fixed","id":"","path":"/pagesC/goods/secKill"}},{"id":"1689817001ofYItT","label":"人人拼团","image":"https://uploadfile.wo-shop.net/uploads/file/20230720/d61a27e300ff1abf7d2f2449b6b70284.png","jump":{"type":"fixed","id":"","path":"/pagesC/goods/assembleList"}},{"id":"1689817020THK7fw","image":"https://uploadfile.wo-shop.net/uploads/file/20230720/76eab41faa2fb0e636aac9c2f3f06854.png","label":"直播","jump":{"type":"fixed","id":"","path":"/pagesC/live/index"}},{"id":"1689817055kWSX7j","label":"店铺街","image":"https://uploadfile.wo-shop.net/uploads/file/20230720/36fa6f6243d8dfa2d76f104d68de439c.png","jump":{"type":"fixed","id":"","path":"/pagesC/shop/shopList"}},{"id":"1689817075GvkCmR","label":"优惠券","image":"https://uploadfile.wo-shop.net/uploads/file/20230720/43eafef0e9d97598acb5725937d72624.png","jump":{"type":"fixed","id":"","path":"/pagesB/coupon/getCoupon"}},{"id":"16898170978v3LNt","label":"新品首发","image":"https://uploadfile.wo-shop.net/uploads/file/20230720/5e8ee825d6171b492697d2ba4dd5294e.png","jump":{"type":"fixed","id":"","path":"/pagesC/goods/tagGoodsList?tag=new"}},{"id":"16898171180WKBIs","label":"积分商城","image":"https://uploadfile.wo-shop.net/uploads/file/20230720/b67f529de2c1654dcd2a3415992f067a.png","jump":{"type":"fixed","id":"","path":"/pagesC/integral/index"}},{"id":"1689817143m9eI6Y","label":"全部分类","image":"https://uploadfile.wo-shop.net/uploads/file/20230720/130bd79b4e118ce306a493ed01922900.png","jump":{"type":"fixed","id":"","path":"/pages/tabBar/category"}}],"attrs":{"model":"fixed","type":"image-text","max":"4"},"styles":{"pagePadding":0,"cmpUpperPadding":0,"cmpLowerPadding":0,"imgPadding":10,"cmpUpperRadius":0,"cmpLowerRadius":0,"imgWidth":50,"imgRadius":0,"fontSize":12,"titleColor":null,"cmpBackground":""},"id":"1689816946a7ytmH","height":186},{"component":"WoMaketCards","name":"营销卡片","icon":"icon-swiper","list":[{"id":"0001","image":"http://110.41.150.71:8090/img/1667354598861.png","title":"人人拼团","describle":"享惊喜折扣","type":"seckill","countDownTime":"","goodsList":[{"id":436,"goods_name":"新款儿童可爱棒球帽网眼绣花卡通太阳帽户外防晒透气遮阳帽鸭舌帽","thumb_url":"https://cbu01.alicdn.com/img/ibank/O1CN01zEtVKZ1efKcK1IGTt_!!2209500663898-0-cib.jpg","market_price":"8.50","shop_price":"8.50","onsale":0,"checked":1,"shop_name":"金梦美妆","cate_name":null,"brand_name":null},{"id":435,"goods_name":"儿童小黄帽幼儿园帽子印logo遮阳防嗮黄色帽小学生渔夫帽定 制","thumb_url":"https://cbu01.alicdn.com/img/ibank/O1CN01nQ37Mz1dPTLrohtbn_!!2214608143728-0-cib.jpg","market_price":"4.50","shop_price":"4.50","onsale":0,"checked":1,"shop_name":"金梦美妆","cate_name":null,"brand_name":null}],"cardType":"seckill","cardModel":"assemble","slogan":"享惊喜折扣","jump":{"type":"fixed","id":"","path":"/pagesC/goods/assembleList"},"tag":"拼团TAG","cardBgColor":"rgba(242, 241, 241, 1)"},{"id":"0002","image":"http://110.41.150.71:8090/img/1667354598861.png","title":"新品首发","describle":"享优惠福利","type":"seckill","goodsTag":"","goodsList":[{"id":432,"goods_name":"2022年新款夏季打底衫韩版修身短款学生上衣潮撞色圆领短袖t恤女","thumb_url":"https://cbu01.alicdn.com/img/ibank/O1CN01x7IVEe2JUhfhtCYen_!!2204599425-0-cib.jpg","market_price":"6.00","shop_price":"6.00","onsale":0,"checked":1,"shop_name":"金梦美妆","cate_name":null,"brand_name":null},{"id":422,"goods_name":"polo衫定印制工作服印字logo做短袖恤翻领服装团体文化衫工衣刺绣","thumb_url":"https://cbu01.alicdn.com/img/ibank/O1CN01tGmZ7d1d3UMFXvGM0_!!2835843680-0-cib.jpg","market_price":"32.00","shop_price":"32.00","onsale":0,"checked":1,"shop_name":"金梦美妆","cate_name":null,"brand_name":null}],"tag":"新品首发","cardType":"live","slogan":"美好新生活","cardModel":"new_goods","jump":{"type":"fixed","id":"","path":"/pagesC/goods/tagGoodsList?tag=new"}},{"id":"0003","image":"http://110.41.150.71:8090/img/1667354598861.png","title":"热门直播","describle":"美好新生活","type":"seckill","goodsTag":"","goodsList":[{"id":417,"goods_name":"婴儿连体衣春秋时尚英伦风绅士蝴蝶结婴儿衣服初生纯棉宝宝哈衣","thumb_url":"https://cbu01.alicdn.com/img/ibank/2018/167/201/9342102761_1893658871.jpg","market_price":"42.00","shop_price":"45.00","onsale":1,"checked":1,"shop_name":"金梦美妆","cate_name":null,"brand_name":null},{"id":418,"goods_name":"2023夏季新款新生儿男女宝宝连体哈衣 针织贴布印花短袖包屁衣","thumb_url":"https://cbu01.alicdn.com/img/ibank/O1CN01Nklv6Z1hAawiTmxPR_!!2222924237-0-cib.jpg","market_price":"26.90","shop_price":"28.30","onsale":1,"checked":1,"shop_name":"金梦美妆","cate_name":null,"brand_name":null}],"tag":"直播","slogan":"省钱省心","cardModel":"new_goods","jump":{"type":"fixed","id":"","path":"/pagesC/live/index"}},{"id":"0004","image":"http://110.41.150.71:8090/img/1667354598861.png","title":"限时秒杀","describle":"省钱省心","type":"seckill","goodsTag":"","goodsList":[{"id":432,"goods_name":"2022年新款夏季打底衫韩版修身短款学生上衣潮撞色圆领短袖t恤女","thumb_url":"https://cbu01.alicdn.com/img/ibank/O1CN01x7IVEe2JUhfhtCYen_!!2204599425-0-cib.jpg","market_price":"6.00","shop_price":"6.00","onsale":0,"checked":1,"shop_name":"金梦美妆","cate_name":null,"brand_name":null},{"id":435,"goods_name":"儿童小黄帽幼儿园帽子印logo遮阳防嗮黄色帽小学生渔夫帽定 制","thumb_url":"https://cbu01.alicdn.com/img/ibank/O1CN01nQ37Mz1dPTLrohtbn_!!2214608143728-0-cib.jpg","market_price":"4.50","shop_price":"4.50","onsale":0,"checked":1,"shop_name":"金梦美妆","cate_name":null,"brand_name":null},{"id":436,"goods_name":"新款儿童可爱棒球帽网眼绣花卡通太阳帽户外防晒透气遮阳帽鸭舌帽","thumb_url":"https://cbu01.alicdn.com/img/ibank/O1CN01zEtVKZ1efKcK1IGTt_!!2209500663898-0-cib.jpg","market_price":"8.50","shop_price":"8.50","onsale":0,"checked":1,"shop_name":"金梦美妆","cate_name":null,"brand_name":null}],"slogan":"享惊喜折扣","tag":"秒杀","cardModel":"assemble","jump":{"type":"fixed","id":"","path":"/pagesC/goods/secKill"}}],"attrs":{"model":"basis","autoplay":true,"loop":true,"listModel":"towCols"},"styles":{"pagePadding":7,"negativeMarginBottom":14},"id":"1685308052oBtQuV","height":355.875},{"component":"McGoods","name":"商品","icon":"icon-shangpin","goodsData":[{"id":"1690016677v1wLLT","list":[{"id":436,"goods_name":"新款儿童可爱棒球帽网眼绣花卡通太阳帽户外防晒透气遮阳帽鸭舌帽","thumb_url":"https://cbu01.alicdn.com/img/ibank/O1CN01zEtVKZ1efKcK1IGTt_!!2209500663898-0-cib.jpg","market_price":"8.50","shop_price":"8.50","onsale":0,"checked":1,"shop_name":"金梦美妆","cate_name":null,"brand_name":null},{"id":435,"goods_name":"儿童小黄帽幼儿园帽子印logo遮阳防嗮黄色帽小学生渔夫帽定 制","thumb_url":"https://cbu01.alicdn.com/img/ibank/O1CN01nQ37Mz1dPTLrohtbn_!!2214608143728-0-cib.jpg","market_price":"4.50","shop_price":"4.50","onsale":0,"checked":1,"shop_name":"金梦美妆","cate_name":null,"brand_name":null},{"id":434,"goods_name":"川井蚕丝氨基酸润滑油300ml爽水溶免洗润滑剂润滑液成人情趣用品","thumb_url":"https://cbu01.alicdn.com/img/ibank/O1CN01L2TiDK1pYQUc0Umr4_!!2215180245372-0-cib.jpg","market_price":"5.20","shop_price":"5.20","onsale":0,"checked":1,"shop_name":"金梦美妆","cate_name":null,"brand_name":null},{"id":432,"goods_name":"2022年新款夏季打底衫韩版修身短款学生上衣潮撞色圆领短袖t恤女","thumb_url":"https://cbu01.alicdn.com/img/ibank/O1CN01x7IVEe2JUhfhtCYen_!!2204599425-0-cib.jpg","market_price":"6.00","shop_price":"6.00","onsale":0,"checked":1,"shop_name":"金梦美妆","cate_name":null,"brand_name":null},{"id":420,"goods_name":"现货2023款夏季baby棉新款格子短袖衬衫哈衣 婴儿宝宝短袖连","thumb_url":"https://cbu01.alicdn.com/img/ibank/O1CN01MLLiIw1QqPUhsunt8_!!2645092027-0-cib.jpg","market_price":"36.00","shop_price":"36.00","onsale":1,"checked":1,"shop_name":"金梦美妆","cate_name":null,"brand_name":null},{"id":419,"goods_name":"纯棉泡泡纱布哈衣新生儿爬服ins男女宝宝夏季薄款短袖婴儿连体衣","thumb_url":"https://cbu01.alicdn.com/img/ibank/O1CN01Rr8knb1ToWioeHgJM_!!4222962429-0-cib.jpg","market_price":"18.00","shop_price":"22.00","onsale":1,"checked":1,"shop_name":"金梦美妆","cate_name":null,"brand_name":null}]}],"attrs":{"model":"transverse","tabModel":"tab1","listModel":"oneCols","itemAlign":"left","showTitle":true,"showInfo":false,"showOriginalPrice":false,"buyText":"购买"},"styles":{"pagePadding":0,"wrapPadding":0,"cmpUpperRadius":0,"cmpLowerRadius":0,"titleColor":"#000000","subTitleColor":"#7F8080","background":"#ffffff","tabActiveColor":"#000000","buyBackgroundColor":"#df201e"},"id":"1685406063tZsSnR","height":796}]}],"_id":"646b61a36825ef2b42526f16","name":"woshop-可视化编辑","cover":"https://i.niupic.com/images/2022/11/02/aaa2.jpeg","config":{"navigation":{"label":"导航","styles":{"background":"#fff"},"list":[{"id":"00001","icon":"icon-shop","text":"首页","jump":{"type":"custom","id":"000000"}},{"id":"00003","icon":"icon-sort","text":"分类","jump":{"type":"fixed","id":"category"}},{"id":"00004","icon":"icon-cart","text":"购物车","jump":{"type":"fixed","id":"car"}},{"id":"00005","icon":"icon-my","text":"我的","jump":{"type":"fixed","id":"my"}}]},"goodsGroups":[{"name":"新品上架","type":"0001","level":1,"child":[]},{"name":"热销排行","type":"0002","level":1,"child":[]}],"listTpl":{"model":"one","addIcon":"cart"},"categoryTpl":{"advertising":false},"hotList":[],"backgroundColor":"rgba(249, 249, 249, 1)"},"type":"mall","industry":"department","logo":"http://110.41.150.71:8090/img/1667353444841.png","__v":0,"id":"646b61a36825ef2b42526f16","userId":"646b616d6825ef2b42526f15"}';
        }
        datamsg(200,'获取成功',$front_layout);
    }

    public function getPluginDiylayout(){
        $where['name'] = "diylayout";
        $where['status'] = 1;
        $where['isclose'] = 1;
        $is_diylayout = Db::name("plugin")->where($where)->find();
        $responseResult['is_diylayout'] = 0;
        if($is_diylayout){
            $responseResult['is_diylayout'] = 1;
        }
        datamsg(200,'获取成功',$responseResult);
    }
}